//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "InstanceModelEvaluation.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <fstream>
#include <iostream>
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#define MAX_SIZE 500000
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
InstanceModelEvaluation::InstanceModelEvaluation () {

  this->domain                = new String ();
  this->valueSMOEvaluation    = 0;
  this->numberFoundPatterns   = 0;
  this->classification        = new String ();
  this->toString              = new String ();

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
InstanceModelEvaluation::InstanceModelEvaluation (const InstanceModelEvaluation& instanceModelEvaluation) {

  this->domain              = new String (instanceModelEvaluation.domain);
  this->valueSMOEvaluation  = instanceModelEvaluation.valueSMOEvaluation;
  this->numberFoundPatterns = instanceModelEvaluation.numberFoundPatterns;
  this->classification      = new String (instanceModelEvaluation.classification);
  
  this->toString            = new String (instanceModelEvaluation.toString);

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
InstanceModelEvaluation::InstanceModelEvaluation (const InstanceModelEvaluation* instanceModelEvaluation) {

  this->domain              = new String (instanceModelEvaluation->domain);
  this->valueSMOEvaluation  = instanceModelEvaluation->valueSMOEvaluation;
  this->numberFoundPatterns = instanceModelEvaluation->numberFoundPatterns;
  this->classification      = new String (instanceModelEvaluation->classification);
  
  this->toString            = new String (instanceModelEvaluation->toString);

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
InstanceModelEvaluation::~InstanceModelEvaluation () {

  if (this->toString)       delete this->toString;
  if (this->classification) delete this->classification;
  if (this->domain)         delete this->domain;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void InstanceModelEvaluation::Domain (String* domain) {

  if (domain)
    *(this->domain) = *domain;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void InstanceModelEvaluation::ValueSMOEvaluation (float valueSMOEvaluation) {

  this->valueSMOEvaluation = valueSMOEvaluation;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void InstanceModelEvaluation::NumberFoundPatterns (int numberFoundPatterns) {

  this->numberFoundPatterns = numberFoundPatterns;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void InstanceModelEvaluation::Classification (String* classification) {

  if (classification)
    *(this->classification) = *classification;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* InstanceModelEvaluation::Domain (void) {

  return this->domain;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
float InstanceModelEvaluation::ValueSMOEvaluation (void) {

  return this->valueSMOEvaluation;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int InstanceModelEvaluation::NumberFoundPatterns (void) {

  return this->numberFoundPatterns;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* InstanceModelEvaluation::Classification (void) {

  return this->classification;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* InstanceModelEvaluation::ToString (void) {

  this->toString->In("");
  
  char buffer [MAX_SIZE];
  
  sprintf(buffer, "%s,%f,%d,%s\0", this->domain->Out(), this->valueSMOEvaluation, this->numberFoundPatterns, this->classification->Out());
  this->toString->In(buffer);
  
  return this->toString;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
InstanceModelEvaluation InstanceModelEvaluation::operator= (const InstanceModelEvaluation& instanceModelEvaluation) {

  *(this->classification)   = *(instanceModelEvaluation.classification);
  *(this->domain)           = *(instanceModelEvaluation.domain);
  
  this->valueSMOEvaluation  = instanceModelEvaluation.valueSMOEvaluation;
  this->numberFoundPatterns = instanceModelEvaluation.numberFoundPatterns;

  *(this->toString)         = *(instanceModelEvaluation.toString);

  return *this;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
